home *** CD-ROM | disk | FTP | other *** search
/ VRML Browsing & Building Cyberspace / VRML - Browsing and Building Cyberspace.iso / examples / eighth.wrl < prev    next >
Text File  |  1995-06-13  |  2KB  |  73 lines

  1. #VRML V1.0 ascii
  2.  
  3. # Example eight -create a link from the Sun to an HTML document
  4.  
  5. # Here comes the Sun
  6. # The Separator node groups everything within it together
  7. Separator {
  8.  
  9.     # The material will effect all subsequent nodes
  10.     # The sun is yellow, isn't it?  Additive color means red + green = yellow
  11.     # We're switching to emissive color because the Sun gives off light.
  12.     Material {
  13.         emissiveColor 1 1 0        # The Sun emits lots of yellow light
  14.     }
  15.  
  16.     # The WWWAnchor node is a group node
  17.     # This means that all objects within it are linked with the anchor's URL
  18.     # We want to link the Sun, so the Sun's Sphere node goes inside of it.
  19.     WWWAnchor {
  20.         name "http://www.w3.org/" # The root URL of the World Wide Web
  21.  
  22.         # Inside the anchor, because WWWAnchor is a group node
  23.         Sphere {
  24.             radius 10        # Big Sun
  25.         }
  26.     }
  27.  
  28.     # We place the Earth within it's own Separator
  29.     # To keep everything good and isolated
  30.     Separator {
  31.  
  32.         # Let's move things out of the way here
  33.         Transform {
  34.             translation 0 20 20
  35.         }
  36.  
  37.         # Color the Earth blue, and make it absorb light
  38.         # But also make it a reflective, like water
  39.         Material {
  40.             diffuseColor 0 0 1 # Big blue marble
  41.             shininess 0.9 # Water is rather shiny
  42.         }
  43.  
  44.         # Finally, create the earth
  45.         Sphere {
  46.             radius 2    # Little Earth
  47.         }
  48.  
  49.         # The Moon gets its own Separator
  50.         # Because we really do keep everything separate
  51.         Separator {
  52.  
  53.             # The Moon is just outside the Earth
  54.             Transform {
  55.                 translation 4 4 0
  56.             }
  57.  
  58.             # Color the Moon grey, make it absorb light
  59.             # It's a little shiny, but not much
  60.             Material {
  61.                 diffuseColor 0.7 0.7 0.7
  62.                 shininess 0.3
  63.             }
  64.  
  65.             # And now, create the Moon
  66.             Sphere {
  67.                 radius 1    # Tiny Moon
  68.             }
  69.         }
  70.     }
  71. }
  72.  
  73.